#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec  8 17:12:35 2023

@author: liqingsimac
"""

'''
########################################################
##Midterm 4: 柯西定理
import sympy as sy
t = sy.symbols('t')
x = sy.symbols('x')
u=1-sy.sqrt(1-18*sy.log(1-t))
u4=u.series(t,0,4)
print(u4)
y=u4.subs(t,2*x)/3
print(y)


v=sy.log(1-t)
v.series(t,0,4)

w=sy.sqrt(1+t)
w.series(t,0,4)
########################################################
'''

#'''
########################################################
##Midterm 4: 单向结点

import numpy as np
import matplotlib.pyplot as plt

m=5
x=np.linspace(-m,m,15)
y=np.linspace(-m,m,15)
[X,Y] = np.meshgrid(x,y)

A=[3,1,-1,1]
[a,b,c,d]=A

U=a*X+b*Y
V=c*X+d*Y
C=(X**2+Y**2)/np.max(X**2+Y**2)

fig, ax = plt.subplots()
ax.quiver(X,Y,U,V,C)
ax.set_xticks([])
ax.set_yticks([])
ax.set_aspect('equal')
       
C1=[-4,-2,0,2,4]
C2=[-4,-2,0,2,4]

t=np.linspace(-2,2,50)
for k1 in range(len(C1)):
    for k2 in range(len(C2)):
        xg=(C1[k1]*t+C2[k2]+C1[k1])*np.exp(2*t)
        yg=-(C1[k1]*t+C2[k2])*np.exp(2*t)
        ax.plot(xg,yg,'-')
ax.set_xlim(-m,m)
ax.set_ylim(-m,m)
########################################################
#'''









